package cn.hahah.module.blog.dal.mysql.articletype;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.articletype.ArticleTypeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.articletype.vo.*;

/**
 * 文章分类 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ArticleTypeMapper extends BaseMapperX<ArticleTypeDO> {

    default PageResult<ArticleTypeDO> selectPage(ArticleTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ArticleTypeDO>()
                .likeIfPresent(ArticleTypeDO::getName, reqVO.getName())
                .eqIfPresent(ArticleTypeDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(ArticleTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ArticleTypeDO::getId));
    }

}